#ifndef __SPRITE_H__
#define __SPRITE_H__

#include <d3d9.h>
#include <d3dx9.h>
#include "Graphic.h"
#include "Camera.h"

class CSprite {
protected:
	LPDIRECT3DTEXTURE9 _image;
	static LPD3DXSPRITE _spriteHander;

	int _index;
	int _width;
	int _height;
	int _count;
	int _spritePerRow;

	
	bool _isChangeAlpha;

	static LPDIRECT3DTEXTURE9 LoadTexture(LPCSTR filePath, D3DCOLOR transcolor);
public:
	int _alpha;

	void ChangeAlpha(bool changeAlpha);
	static void InitSpriteHander(D3DXGraphic *gfx);
	CSprite::CSprite(LPSTR FilePath, int Width, int Height, int index, int Count, int SpritePerRow, int alpha, bool isAlpha, D3DCOLOR transparent);
	void Next();
	void Reset();

	// Render current sprite at location (X,Y) at the target surface
	void Render(float X, float Y);
	~CSprite();
};

#endif